package com.itheima.a02jdk8datedemo;

import java.time.ZoneId;
import java.time.ZonedDateTime;

public class ZonedDateTimeDemo1 {
    public static void main(String[] args) {
        //获取当前时间的ZonedDateTime时间对象
        ZonedDateTime now = ZonedDateTime.now();
        System.out.println(now);
        //获取指定时间的ZonedDateTime时间对象
        ZonedDateTime zonedDateTime = ZonedDateTime.of(2025, 4, 12,
                12, 12, 12, 12,
                ZoneId.of("Asia/Shanghai"));
        System.out.println(zonedDateTime);
        //修改时间系列的方法
        ZonedDateTime zonedDateTime1 = now.withDayOfMonth(20);
        System.out.println(zonedDateTime1);
        //减少时间系列的方法
        ZonedDateTime zonedDateTime2 = now.minusDays(2);
        System.out.println(zonedDateTime2);
        //增加时间系列的方法
        ZonedDateTime zonedDateTime3 = now.plusDays(2L);
        System.out.println(zonedDateTime3);
    }
}
